function formatTime(timeISO) {
    const date = new Date(timeISO);
    if (date == null) {
        return "";
    }
    // 获取年、月、日、小时、分钟和秒
    const year = date.getFullYear();
    const month = ("0" + (date.getMonth() + 1)).slice(-2); // 补零以确保两位数
    const day = ("0" + date.getDate()).slice(-2);
    const hours = ("0" + date.getHours()).slice(-2);
    const minutes = ("0" + date.getMinutes()).slice(-2);
    const seconds = ("0" + date.getSeconds()).slice(-2);
    // console.log(`${year}-${month}-${day} ${hours}:${minutes}:${seconds}`)

    // 返回格式化后的时间字符串，包含日期和时分秒
    return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}

export {formatTime};